/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */


struct ListNode* middleNode(struct ListNode* head){
    if(!head)
        return NULL;
    //双指针
    struct ListNode* fast = head;
    struct ListNode* slow = head;
    while(fast && (fast->next)){
        fast = fast->next->next;
        slow  = slow->next;
    }    
    return slow;
}